//
//  RegisterViewController.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/3/30.
//

import UIKit

class RegisterViewController: BaseViewController {
    let firstVC = RegisterFirstViewController()
    let secondVC = RegisterSecondViewController()
    override func viewDidLoad() {
        super.viewDidLoad()
        self.secondVC.model = firstVC.model
        //
        self.addChildVC(secondVC)
        self.addChildVC(firstVC)
        //
        self.firstVC.customView.continueBtn.addTarget(self, action: #selector(toSecondVC), for: UIControl.Event.touchUpInside)
        //从second回到first
        self.secondVC.customView.backBtn.addTarget(self, action: #selector(toFirstVC), for: UIControl.Event.touchUpInside)
        self.secondVC.customView.backToPreBtn.addTarget(self, action: #selector(toFirstVC), for: UIControl.Event.touchUpInside)
    }
    @objc private func toSecondVC() {
        self.transition(from: firstVC, to: secondVC, duration: 0.5,animations: nil)
    }
    @objc private func toFirstVC() {
        self.transition(from: secondVC, to: firstVC, duration: 0.5, animations: nil)
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.setNavigationBarHidden(true, animated: true)
    }
}
